package t_686

import (
	"fmt"
	"strings"
)

func repeatedStringMatch(a string, b string) int {
	la, lb := len(a), len(b)

	// 边界 b在a内 max<=a
	//      b需a首尾相接  max<=2a
	//      b有多个a组成，首尾任意  max<=b
	// 没有相似
	maxLen := la*2 + lb

	t, count := "", 0
	for len(t) < maxLen {
		if strings.Contains(t, b) {
			return count
		}
		t += a
		count++
	}
	return -1
}

func fib(n int) int {

	if n < 2 {
		return n
	}
	dp := make([]int, n+1)
	dp[0] = 0
	dp[1] = 1
	arr := [5]int8{1, 3, 4, 5, 0}
	for i := 0; i < 5; i++ {
		fmt.Printf("%X\r\n", &arr[i])
	}
	fmt.Println("==============")
	for i := 0; i < n+1; i++ {
		fmt.Printf("%X\r\n", &dp[i])
	}
	fmt.Println("==============")
	for i := 2; i < n+1; i++ {
		fmt.Printf("%X\r\n", &dp[i])
		dp[i] = dp[i-1] + dp[i-2]
	}

	return dp[n]
}
